DEFINITION MODULE DosStdIO ;

(* ANSI-like stdio defines for dos buffered I/O *)

FROM SYSTEM IMPORT ADDRESS, STRING ;

(* MACROS *)

PROCEDURE ReadChar( ) : LONGINT ;

PROCEDURE WriteChar ( c : LONGINT ) : LONGINT ;
PROCEDURE UnReadChar( c : LONGINT ) : LONGINT ;

(* next one is inefficient *)

PROCEDURE ReadChars( buf : ADDRESS ; num : LONGINT ) : LONGINT ;
PROCEDURE ReadLn( buf : STRING ; len : LONGINT ) : STRING ;

PROCEDURE WriteStr( s : STRING ) : LONGINT ;
PROCEDURE VWritef( format : STRING ; argv : ADDRESS ) ;

(* types for SetVBuf *)
CONST
  BUF_LINE = 0 ; (* flush on \n, etc		   *)
  BUF_FULL = 1 ; (* never flush except when needed *)
  BUF_NONE = 2 ; (* no buffering		   *)

(* EOF return value *)
  ENDSTREAMCH = -1 ;

END DosStdIO.
